#include<iostream>
using namespace std;

class Date
{
	friend ostream& operator<<(ostream& out,const Date& d);

	friend istream& operator>>(istream& in, Date& d);

public:
	void Print() const;

	Date(int year = 1900, int month = 100, int day = 100);

	int GetMonthDay(int year,int month)
	{
		static int arr[13] = {-1,31,28,31,30,31,30,31,31,30,31,30,31};
		if (2 == month && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
		{
			return 29;
		}
		return arr[month];
	}

	Date& operator+=(int day);

	Date operator+(int day);

	Date& operator-=(int day);

	Date operator-(int day);

	bool operator<(const Date& d);

	bool operator<=(const Date& d);

	bool operator>(const Date& d);

	bool operator>=(const Date& d);

	bool operator==(const Date& d);

	bool operator!=(const Date& d);

	Date& operator++();

	Date operator++(int);

	int operator-(const Date& d);

	bool CheckDate();


private:
	int _year;
	int _month;
	int _day;
};

ostream& operator<<(ostream& out,const Date& d);

istream& operator>>(istream& in,Date& d);